SELE 8
set exclu off
USE &DR&F8 INDE &DR&F8
SEEK KDPAT
IF .NOT. EOF()
   CMS=.T.
   INSTYP=PAT_INSTYP
   INSNAM=PAT_INSNAM
   INSVAL=PAT_INSVAL
ELSE
   CMS=.F.
ENDIF
SELE 7
set exclu off
USE &DR&F7 INDE &DR&F7
SEEK KDPAT
IF .NOT. EOF()
   TEMU=.T.
   REC=RECNO()
   NMPAT=PAT_NAME
   FNMPAT=PAT_F_NAME
   MNMPAT=PAT_M_INIT
   ISEX=PAT_SEX
   NATIO=PAT_NATIO
   DOBPAT=PAT_DOB
   health=healthline
   HLDATE=hl_end
   CMS=PAT_CMS
   IF PAT_CMS .AND. INSVAL>DATE()
      CMS=.T.
   ELSE
      CMS=.F.
   ENDIF
ELSE
   TEMU=.F.
ENDIF
